Return to start page
Systems/BonusMod/Library Bonus Mod.j
1 /**
2 * The Bonus Mod (originally created by @author weaaddar) is a famous system
3 * for modifing specific unit properties where Jass natives are missed and can not be used.
4 * It uses a special method by adding and removing property-modifying abilities to a unit.
5 * For this reason it allows the user to modify damage, armour, hit points, mana, sight range, hit point regeneration and mana regeneration of a unit.
6 * Note that you've to call @function AInitBonusMod before using this library.
7 * It won't be called by default (using it as initializer) since this would be decrease the performance for users who maybe won't use it at all.
8 * Here's a list of natives for changing unit properties:
9 * @function SetUnitState For changing life, maximum life, mana and maximum mana.
10 * @function SetUnitMoveSpeed
11 * @function SetUnitAcquireRange
12 * @function SetUnitBlendTime
13 * @function SetUnitFlyHeight
14 * @function SetUnitFog
15 * @function SetUnitScale
16 * ...
17 * @author weaaddar
18 */
19 library ALibrarySystemsBonusModBonusMod requires AStructCoreGeneralHashTable, optional ALibraryCoreDebugMisc
20
21 //! textmacro A_BONUS_MOD_DAMAGE takes RAWCODE, NAME, VALUE
22 //! external ObjectMerger w3a AItg $RAWCODE$ Iatt 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
23 //! endtextmacro
24
25 //! textmacro A_BONUS_MOD_ARMOR takes RAWCODE, NAME, VALUE
26 //! external ObjectMerger w3a AId1 $RAWCODE$ Idef 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
27 //! endtextmacro
28
29 //! textmacro A_BONUS_MOD_LIFE takes RAWCODE, NAME, VALUE
30 //! external ObjectMerger w3a AIl2 $RAWCODE$ Ilif 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
31 //! endtextmacro
32
33 //! textmacro A_BONUS_MOD_MANA takes RAWCODE, NAME, VALUE
34 //! external ObjectMerger w3a AImb $RAWCODE$ Iman 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
35 //! endtextmacro
36
37 //! textmacro A_BONUS_MOD_SIGHT_RANGE takes RAWCODE, NAME, VALUE
38 //! external ObjectMerger w3a AIsi $RAWCODE$ Isib 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
39 //! endtextmacro
40
41 //! textmacro A_BONUS_MOD_LIFE_REGENERATION takes RAWCODE, NAME, VALUE
42 //! external ObjectMerger w3a Arel $RAWCODE$ Ihpr 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
43 //! endtextmacro
44
45 //! textmacro A_BONUS_MOD_MANA_REGENERATION takes RAWCODE, NAME, VALUE
46 //! external ObjectMerger w3a AIrm $RAWCODE$ Imrp 1 $VALUE$ anam "$NAME$" ansf "ASL" aart ""
47 //! endtextmacro
48
49 /*
50 //Uncomment this to use Bonus Mod.
51 //A1
52 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ0", "Damage +1", "1")
53 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ1", "Damage +2", "2")
54 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ2", "Damage +4", "4")
55 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ3", "Damage +8", "8")
56 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ4", "Damage +16", "16")
57 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ5", "Damage +32", "32")
58 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ6", "Damage +64", "64")
59 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ7", "Damage +128", "128")
60 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ8", "Damage +256", "256")
61 //! runtextmacro A_BONUS_MOD_DAMAGE("AZZ9", "Damage -512", "-512")
62
63 //! runtextmacro A_BONUS_MOD_ARMOR("AZY0", "Armor +1", "1")
64 //! runtextmacro A_BONUS_MOD_ARMOR("AZY1", "Armor +2", "2")
65 //! runtextmacro A_BONUS_MOD_ARMOR("AZY2", "Armor +4", "4")
66 //! runtextmacro A_BONUS_MOD_ARMOR("AZY3", "Armor +8", "8")
67 //! runtextmacro A_BONUS_MOD_ARMOR("AZY4", "Armor +16", "16")
68 //! runtextmacro A_BONUS_MOD_ARMOR("AZY5", "Armor +32", "32")
69 //! runtextmacro A_BONUS_MOD_ARMOR("AZY6", "Armor +64", "64")
70 //! runtextmacro A_BONUS_MOD_ARMOR("AZY7", "Armor +128", "128")
71 //! runtextmacro A_BONUS_MOD_ARMOR("AZY8", "Armor +256", "256")
72 //! runtextmacro A_BONUS_MOD_ARMOR("AZY9", "Armor -512", "-512")
73
74 //! runtextmacro A_BONUS_MOD_LIFE("AZX0", "Life +10", "10")
75 //! runtextmacro A_BONUS_MOD_LIFE("AZX1", "Life +20", "20")
76 //! runtextmacro A_BONUS_MOD_LIFE("AZX2", "Life +40", "40")
77 //! runtextmacro A_BONUS_MOD_LIFE("AZX3", "Life +80", "80")
78 //! runtextmacro A_BONUS_MOD_LIFE("AZX4", "Life +160", "160")
79 //! runtextmacro A_BONUS_MOD_LIFE("AZX5", "Life +320", "320")
80 //! runtextmacro A_BONUS_MOD_LIFE("AZX6", "Life +640", "640")
81 //! runtextmacro A_BONUS_MOD_LIFE("AZX7", "Life +1280", "1280")
82 //! runtextmacro A_BONUS_MOD_LIFE("AZX8", "Life +2560", "2560")
83 //! runtextmacro A_BONUS_MOD_LIFE("AZX9", "Life -5120", "-5120")
84
85 //! runtextmacro A_BONUS_MOD_MANA("AZW0", "Mana +10", "10")
86 //! runtextmacro A_BONUS_MOD_MANA("AZW1", "Mana +20", "20")
87 //! runtextmacro A_BONUS_MOD_MANA("AZW2", "Mana +40", "40")
88 //! runtextmacro A_BONUS_MOD_MANA("AZW3", "Mana +80", "80")
89 //! runtextmacro A_BONUS_MOD_MANA("AZW4", "Mana +160", "160")
90 //! runtextmacro A_BONUS_MOD_MANA("AZW5", "Mana +320", "320")
91 //! runtextmacro A_BONUS_MOD_MANA("AZW6", "Mana +640", "640")
92 //! runtextmacro A_BONUS_MOD_MANA("AZW7", "Mana +1280", "1280")
93 //! runtextmacro A_BONUS_MOD_MANA("AZW8", "Mana +2560", "2560")
94 //! runtextmacro A_BONUS_MOD_MANA("AZW9", "Mana -5120", "-5120")
95
96 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV0", "Sight range +10", "10")
97 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV1", "Sight range +20", "20")
98 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV2", "Sight range +40", "40")
99 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV3", "Sight range +80", "80")
100 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV4", "Sight range +160", "160")
101 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV5", "Sight range +320", "320")
102 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV6", "Sight range +640", "640")
103 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV7", "Sight range +1280", "1280")
104 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV8", "Sight range +2560", "2560")
105 //! runtextmacro A_BONUS_MOD_SIGHT_RANGE("AZV9", "Sight range -5120", "-5120")
106
107 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU0", "Life regeneration +1", "1")
108 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU1", "Life regeneration +2", "2")
109 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU2", "Life regeneration +4", "4")
110 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU3", "Life regeneration +8", "8")
111 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU4", "Life regeneration +16", "16")
112 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU5", "Life regeneration +32", "32")
113 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU6", "Life regeneration +64", "64")
114 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU7", "Life regeneration +128", "128")
115 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU8", "Life regeneration +256", "256")
116 //! runtextmacro A_BONUS_MOD_LIFE_REGENERATION("AZU9", "Life regeneration -512", "-512")
117
118 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT0", "Mana regeneration +1", "1")
119 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT1", "Mana regeneration +2", "2")
120 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT2", "Mana regeneration +4", "4")
121 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT3", "Mana regeneration +8", "8")
122 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT4", "Mana regeneration +16", "16")
123 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT5", "Mana regeneration +32", "32")
124 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT6", "Mana regeneration +64", "64")
125 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT7", "Mana regeneration +128", "128")
126 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT8", "Mana regeneration +256", "256")
127 //! runtextmacro A_BONUS_MOD_MANA_REGENERATION("AZT9", "Mana regeneration -512", "-512")
128 */
129
130 globals
131 constant integer A_BONUS_TYPE_DAMAGE = 0
132 constant integer A_BONUS_TYPE_ARMOR = 1
133 constant integer A_BONUS_TYPE_LIFE = 2
134 constant integer A_BONUS_TYPE_MANA = 3
135 constant integer A_BONUS_TYPE_SIGHT_RANGE = 4 // Sight Range Bonus
136 constant integer A_BONUS_TYPE_MANA_REGENERATION = 5 // Mana Regeneration Bonus (A % value)
137 constant integer A_BONUS_TYPE_LIFE_REGENERATION = 6 // Life Regeneration Bonus (An absolute value)
138 constant integer A_BONUS_MAX_TYPES = 7
139 /**
140 * Bonus Mod's Number of abilities per bonus, if last power of 2 ability is -512,
141 * this shall be 10, and the maximum bonus would be 511 while the minimum -512.
142 */
143 private constant integer IxLimit = 10
144 /**
145 * If it is 10, the hp, mana abilities will be: 10, 20,40,80,160,...
146 * If it is 1, they would be : 1,2,4,8,16,...
147 * If it is 5, they would be: 5,10,20,40,80,..
148 */
149 private constant integer BonusBigValuesFactor = 10
150 private integer array abilityId
151 private AHashTable hashTable
152 endglobals
153
154 private function Ix takes integer x, integer y returns integer
155 return (x * IxLimit + y)
156 endfunction
157
158 private function BonusMax takes nothing returns integer
159 return (R2I(Pow(2, Ix(1, 0) - 1)) - 1)
160 endfunction
161
162 private function BonusMin takes nothing returns integer
163 return -R2I(Pow(2, Ix(1, 0) - 1))
164 endfunction
165
166 /// @todo Should be private, vJass bug.
167 debug function CheckType takes integer bonusType returns nothing
168 debug if (bonusType < 0 or bonusType >= A_BONUS_MAX_TYPES) then
169 debug call Print("ABonusMod error: Wrong type, value " + I2S(bonusType) + ".")
170 debug endif
171 debug endfunction
172
173 /**
174 * @param whichUnit Unit which is checked for bonus.
175 * @param bonusType Property type which is checked for.
176 * Possible values are:
177 * @global A_BONUS_TYPE_DAMAGE
178 * @global A_BONUS_TYPE_ARMOR
179 * @global A_BONUS_TYPE_LIFE
180 * @global A_BONUS_TYPE_MANA
181 * @global A_BONUS_TYPE_SIGHT_RANGE
182 * @global A_BONUS_TYPE_MANA_REGENERATION
183 * @global A_BONUS_TYPE_LIFE_REGENERATION
184 * @return Returns units bonus of a specific property.
185 */
186 function AUnitGetBonus takes unit whichUnit, integer bonusType returns integer
187 debug call CheckType(bonusType)
188 return hashTable.handleInteger(whichUnit, I2S(bonusType))
189 endfunction
190
191 /**
192 * Sets units bonus of a specific property.
193 * @param whichUnit Unit which should get bonus.
194 * @param bonusType Property type which is used for setting bonus.
195 * Possible values are:
196 * @global A_BONUS_TYPE_DAMAGE
197 * @global A_BONUS_TYPE_ARMOR
198 * @global A_BONUS_TYPE_LIFE
199 * @global A_BONUS_TYPE_MANA
200 * @global A_BONUS_TYPE_SIGHT_RANGE
201 * @global A_BONUS_TYPE_MANA_REGENERATION
202 * @global A_BONUS_TYPE_LIFE_REGENERATION
203 * @param amount Bonus amount which should be set.
204 * @return Returns if bonus was set successfully.
205 */
206 function AUnitSetBonus takes unit whichUnit, integer bonusType, integer amount returns boolean
207 local integer x
208 local integer i
209 local integer bit
210 local boolean negative
211 local boolean mana
212 debug if (whichUnit == null or bonusType < 0 or bonusType >= A_BONUS_MAX_TYPES) then
213 debug call CheckType(bonusType)
214 debug return false
215 debug endif
216 if (amount == 0) then
217 call hashTable.removeHandleInteger(whichUnit, I2S(bonusType))
218
219 if (bonusType == A_BONUS_TYPE_LIFE and hashTable.hasHandleInteger(whichUnit, "ABonusModLeftLife")) then
220 call hashTable.removeHandleInteger(whichUnit, "ABonusModLeftLife")
221 elseif (bonusType == A_BONUS_TYPE_MANA and hashTable.hasHandleInteger(whichUnit, "ABonusModLeftMana")) then
222 call hashTable.removeHandleInteger(whichUnit, "ABonusModLeftMana")
223 endif
224 elseif (bonusType == A_BONUS_TYPE_LIFE or bonusType == A_BONUS_TYPE_MANA or bonusType == A_BONUS_TYPE_SIGHT_RANGE) then
225 set amount = amount / BonusBigValuesFactor
226 call hashTable.setHandleInteger(whichUnit, I2S(bonusType), amount * BonusBigValuesFactor)
227 else
228 call hashTable.setHandleInteger(whichUnit, I2S(bonusType), amount)
229 endif
230 set mana = (bonusType == A_BONUS_TYPE_MANA) and (GetUnitState(whichUnit, UNIT_STATE_MAX_MANA) <= 0)
231 call UnitRemoveAbility(whichUnit, abilityId[Ix(bonusType, Ix(1, -1))])
232 if (amount < 0) then
233 set negative = true
234 set amount = bit + amount
235 else
236 set negative = false
237 endif
238
239 set i = Ix(1, -1)
240 set bit = R2I(Pow(2, i))
241 loop
242 set bit = bit / 2
243 set i = i - 1
244 exitwhen (i < 0)
245 if (amount >= bit) then
246 set x = abilityId[Ix(bonusType, i)]
247 call UnitAddAbility(whichUnit, x)
248 call UnitMakeAbilityPermanent(whichUnit, true, x)
249 set amount = amount - bit
250 else
251 call UnitRemoveAbility(whichUnit, abilityId[Ix(bonusType, i)])
252 endif
253 endloop
254 if (negative) then
255 set x = abilityId[Ix(bonusType, Ix(1, -1))]
256 call UnitAddAbility(whichUnit, x)
257 call UnitMakeAbilityPermanent(whichUnit, true, x)
258 endif
259 if (mana and (GetUnitState(whichUnit, UNIT_STATE_MAX_MANA) > 0)) then
260 call SetUnitState(whichUnit, UNIT_STATE_MANA, 0)
261 endif
262 return amount == 0
263 endfunction
264
265 /**
266 * Sets units bonus of a specific property to 0. If bonus is set to 0 saved hash table data is cleared automatically.
267 * @param whichUnit Unit which should bonus cleared of.
268 * @param bonusType Property type which is used for adding bonus.
269 * Possible values are:
270 * @global A_BONUS_TYPE_DAMAGE
271 * @global A_BONUS_TYPE_ARMOR
272 * @global A_BONUS_TYPE_LIFE
273 * @global A_BONUS_TYPE_MANA
274 * @global A_BONUS_TYPE_SIGHT_RANGE
275 * @global A_BONUS_TYPE_MANA_REGENERATION
276 * @global A_BONUS_TYPE_LIFE_REGENERATION
277 * @return Returns if bonus was cleared successfully.
278 */
279 function AUnitClearBonus takes unit whichUnit, integer bonusType returns boolean
280 debug call CheckType(bonusType)
281 return AUnitSetBonus(whichUnit, bonusType, 0)
282 endfunction
283
284 /**
285 * Adds bonus of a specific property to unit.
286 * @param whichUnit Unit which should get bonus.
287 * @param bonusType Property type which is used for adding bonus.
288 * Possible values are:
289 * @global A_BONUS_TYPE_DAMAGE
290 * @global A_BONUS_TYPE_ARMOR
291 * @global A_BONUS_TYPE_LIFE
292 * @global A_BONUS_TYPE_MANA
293 * @global A_BONUS_TYPE_SIGHT_RANGE
294 * @global A_BONUS_TYPE_MANA_REGENERATION
295 * @global A_BONUS_TYPE_LIFE_REGENERATION
296 * @param amount Bonus amount which should be added.
297 * @return Returns if bonus was added successfully.
298 */
299 function AUnitAddBonus takes unit whichUnit, integer bonusType, integer amount returns boolean
300 local integer x
301 local boolean b
302 local real l
303 local string s
304 local real min
305 local real mod
306 debug call CheckType(bonusType)
307 if (amount == 0) then
308 return true
309 endif
310 if (bonusType == A_BONUS_TYPE_LIFE or bonusType == A_BONUS_TYPE_MANA or bonusType == A_BONUS_TYPE_SIGHT_RANGE) then
311 //set amount = (amount / BonusBigValuesFactor) * BonusBigValuesManaFactor /// @todo Baradé, ?!!
312 if (bonusType == A_BONUS_TYPE_LIFE) then
313 set l = GetWidgetLife(whichUnit)
314 set mod = ModuloReal(l, BonusBigValuesFactor)
315 set s = "ABonusModLeftLife"
316 if mod >= 1 then
317 set min = 0
318 else
319 set min = BonusBigValuesFactor
320 endif
321 elseif (bonusType == A_BONUS_TYPE_MANA) then
322 set l = GetUnitState(whichUnit, UNIT_STATE_MAX_MANA)
323 set mod = ModuloReal(l, BonusBigValuesFactor)
324 set s = "ABonusModLeftMana"
325 set min = 0
326 endif
327 set amount = amount + hashTable.handleInteger(whichUnit, s)
328 if (amount < 0) and (l + amount < 1) then
329 set x = R2I(min + mod - l)
330 set b = AUnitSetBonus(whichUnit, bonusType, AUnitGetBonus(whichUnit, bonusType) + x)
331 call hashTable.setHandleInteger(whichUnit, s, amount - x)
332 else
333 call hashTable.setHandleInteger(whichUnit, s, 0)
334 set b = AUnitSetBonus(whichUnit, bonusType, AUnitGetBonus(whichUnit, bonusType) + amount)
335 endif
336 return b
337 endif
338 return AUnitSetBonus(whichUnit, bonusType, AUnitGetBonus(whichUnit, bonusType) + amount)
339 endfunction
340
341 /**
342 * The same as @function AUnitAddBonus with a negative amount but a little bit more logic and readable in my opinion.
343 * Removes bonus of a specific property to unit.
344 * @author Tamino Dauth
345 * @param whichUnit Unit which should loose bonus.
346 * @param bonusType Property type which is used for removing bonus.
347 * Possible values are:
348 * @global A_BONUS_TYPE_DAMAGE
349 * @global A_BONUS_TYPE_ARMOR
350 * @global A_BONUS_TYPE_LIFE
351 * @global A_BONUS_TYPE_MANA
352 * @global A_BONUS_TYPE_SIGHT_RANGE
353 * @global A_BONUS_TYPE_MANA_REGENERATION
354 * @global A_BONUS_TYPE_LIFE_REGENERATION
355 * @param amount Bonus amount which should be removed.
356 * @return Returns if bonus was removed successfully.
357 */
358 function AUnitRemoveBonus takes unit whichUnit, integer bonusType, integer amount returns boolean
359 return AUnitAddBonus(whichUnit, bonusType, -amount)
360 endfunction
361
362 /**
363 * So here you set each of the bonus abilities, 0 is damage, 1 armor, 2 health, and 3 mana
364 * The second numbers are the powers (2^1 is 1, 2^2=4, 2^3=8, ...
365 * Remember: Last power ability should be negative.
366 */
367 function AInitBonusMod takes nothing returns nothing
368 //Damage
369 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 0)] = 'AZZ0' //+001
370 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 1)] = 'AZZ1' //+002
371 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 2)] = 'AZZ2' //+004
372 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 3)] = 'AZZ3' //+008
373 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 4)] = 'AZZ4' //+016
374 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 5)] = 'AZZ5' //+032
375 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 6)] = 'AZZ6' //+064
376 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 7)] = 'AZZ7' //+128
377 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 8)] = 'AZZ8' //+256
378 set abilityId[Ix(A_BONUS_TYPE_DAMAGE, 9)] = 'AZZ9' //-512
379 //Armor
380 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 0)] = 'AZY0' //+001
381 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 1)] = 'AZY1' //+002
382 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 2)] = 'AZY2' //+004
383 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 3)] = 'AZY3' //+008
384 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 4)] = 'AZY4' //+016
385 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 5)] = 'AZY5' //+032
386 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 6)] = 'AZY6' //+064
387 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 7)] = 'AZY7' //+128
388 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 8)] = 'AZY8' //+256
389 set abilityId[Ix(A_BONUS_TYPE_ARMOR, 9)] = 'AZY9' //-512
390 //Life
391 set abilityId[Ix(A_BONUS_TYPE_LIFE, 0)] = 'AZX0' //+0010
392 set abilityId[Ix(A_BONUS_TYPE_LIFE, 1)] = 'AZX1' //+0020
393 set abilityId[Ix(A_BONUS_TYPE_LIFE, 2)] = 'AZX2' //+0040
394 set abilityId[Ix(A_BONUS_TYPE_LIFE, 3)] = 'AZX3' //+0080
395 set abilityId[Ix(A_BONUS_TYPE_LIFE, 4)] = 'AZX4' //+0160
396 set abilityId[Ix(A_BONUS_TYPE_LIFE, 5)] = 'AZX5' //+0320
397 set abilityId[Ix(A_BONUS_TYPE_LIFE, 6)] = 'AZX6' //+0640
398 set abilityId[Ix(A_BONUS_TYPE_LIFE, 7)] = 'AZX7' //+1280
399 set abilityId[Ix(A_BONUS_TYPE_LIFE, 8)] = 'AZX8' //+2560
400 set abilityId[Ix(A_BONUS_TYPE_LIFE, 9)] = 'AZX9' //-5120
401 //Mana
402 set abilityId[Ix(A_BONUS_TYPE_MANA, 0)] = 'AZW0' //+0010
403 set abilityId[Ix(A_BONUS_TYPE_MANA, 1)] = 'AZW1' //+0020
404 set abilityId[Ix(A_BONUS_TYPE_MANA, 2)] = 'AZW2' //+0040
405 set abilityId[Ix(A_BONUS_TYPE_MANA, 3)] = 'AZW3' //+0080
406 set abilityId[Ix(A_BONUS_TYPE_MANA, 4)] = 'AZW4' //+0160
407 set abilityId[Ix(A_BONUS_TYPE_MANA, 5)] = 'AZW5' //+0320
408 set abilityId[Ix(A_BONUS_TYPE_MANA, 6)] = 'AZW6' //+0640
409 set abilityId[Ix(A_BONUS_TYPE_MANA, 7)] = 'AZW7' //+1280
410 set abilityId[Ix(A_BONUS_TYPE_MANA, 8)] = 'AZW8' //+2560
411 set abilityId[Ix(A_BONUS_TYPE_MANA, 9)] = 'AZW9' //-5120
412 //Sight Range
413 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 0)] = 'AZV0' //+0010
414 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 1)] = 'AZV1' //+0020
415 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 2)] = 'AZV2' //+0040
416 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 3)] = 'AZV3' //+0080
417 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 4)] = 'AZV4' //+0160
418 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 5)] = 'AZV5' //+0320
419 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 6)] = 'AZV6' //+0640
420 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 7)] = 'AZV7' //+1280
421 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 8)] = 'AZV8' //+2560
422 set abilityId[Ix(A_BONUS_TYPE_SIGHT_RANGE, 9)] = 'AZV9' //-5120
423 //Life Regeneration
424 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 0)] = 'AZU0' //+001
425 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 1)] = 'AZU1' //+002
426 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 2)] = 'AZU2' //+004
427 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 3)] = 'AZU3' //+008
428 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 4)] = 'AZU4' //+016
429 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 5)] = 'AZU5' //+032
430 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 6)] = 'AZU6' //+064
431 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 7)] = 'AZU7' //+128
432 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 8)] = 'AZU8' //+256
433 set abilityId[Ix(A_BONUS_TYPE_LIFE_REGENERATION, 9)] = 'AZU9' //-512
434 //Mana Regneration
435 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 0)] = 'AZT0' //+001
436 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 1)] = 'AZT1' //+002
437 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 2)] = 'AZT2' //+004
438 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 3)] = 'AZT3' //+008
439 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 4)] = 'AZT4' //+016
440 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 5)] = 'AZT5' //+032
441 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 6)] = 'AZT6' //+064
442 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 7)] = 'AZT7' //+128
443 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 8)] = 'AZT8' //+256
444 set abilityId[Ix(A_BONUS_TYPE_MANA_REGENERATION, 9)] = 'AZT9' //-512
445 set hashTable = AHashTable.create()
446 endfunction
447
448 endlibrary